package com.company.utils;

import com.company.service.BaseService;
import com.company.service.LoginService;
import com.company.service.RegistService;
import com.company.service.impl.LoginServiceImpl;
import com.company.service.impl.RegistServiceImpl;
import com.company.service.impl.StartServiceImpl;

public class ServiceFactory {
    private static RegistService registService = null;
    private static LoginService loginService=null;
    public static BaseService getBean(String key){
        if ("Start".equals(key)){
            return new StartServiceImpl();
        }else if("Regist".equals(key)){
            if (registService == null) {
                registService = new RegistServiceImpl();
            }
            return registService;
        }else if("Login".equals(key)){
            if (loginService == null) {
                loginService = new LoginServiceImpl();
            }
            return loginService;
        }
        return null;
    }
}
